package com.ruoyi.common.enums;

public enum  TradeType {
    /**
     * BUY
     */
    BUY(1, "BUY"),
    /**
     * SELL
     */
    SELL(2, "SELL"),
    /**
     * CANCEL
     */
    CANCEL(3, "CANCEL"),
    ;

    TradeType(int code, String name) {
        this.code = code;
        this.name = name;
    }

    private int code;
    private String name;

    public int getCode() {
        return this.code;
    }

    public String getName() {
        return this.name;
    }

    public static TradeType getByCode(int code) {
        TradeType[] array = TradeType.values();
        TradeType temp = null;
        for (int i = 0; i < array.length; i++) {
            temp = array[i];
            if (code == temp.getCode()) {
                return temp;
            }
        }
        return null;
    }
}
